<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
            list-style: none;
        }
        .tab{
            margin: 200px auto;
            height: 400px;
            width: 550px;
        }
        .tab_list{
            height: 40px;
            width: 550px;
            margin-bottom: 10px;
        }
        .tab_list li{
            float: left;
            font-size: 14px;
            height: 40px;
            width: 100px;
            line-height: 40px;
            text-align: center;
        }
        .tab_list .current{
            background-color: rgb(216, 16, 16);
            color: white;
        }
        .tab_list li:hover{
            cursor: pointer;
        }
        .tab_con{
            width: 550px;
            height: 350px;
        }
        .item{
            display: none;
        }
    </style>
</head>
<body>
    <div class="tab">
        <div class="tab_list">
            <ul>
                <li class="current">商品介绍</li>
                <li>规格与包装</li>
                <li>售后保障</li>
                <li style="width: 120px;">商品价格(5000+)</li>
                <li>手机社区</li>
            </ul>
        </div>
        <div class="tab_con">
            <div class="item" style="display: block;">商品介绍模块内容</div>
            <div class="item">包装与规格模块内容</div>
            <div class="item">售后保障模块内容</div>
            <div class="item">商品评价（5000+）内容模块</div>
            <div class="item">手机社区模块内</div>
        </div>
    </div>
    <script>
        var tab_list=document.querySelector('.tab_list');
        var lis=tab_list.querySelectorAll('li');
        var items=document.querySelectorAll('.item');
        //排他思想
        for(var i=0;i<lis.length;i++){
            lis[i].setAttribute('index',i);
            lis[i].onclick=function(){
                for(var j=0;j<lis.length;j++){
                    lis[j].className='';
                }
                this.className='current';
                //下面显示内容模块
                 var index=this.getAttribute('index');
                 //排他思想
                 for(var k=0;k<items.length;k++){
                    items[k].style.display='none';
                 }
                 items[index].style.display='block';
            }
        }
    </script>
</body>
</html>